// JavaScript Document
function btnSearch_Click(){
	var request = new XMLHttpRequest();
	var url = "service.php?number="+document.getElementById("keyword").value;	
	request.open("GET", url, true);
	request.send();
	request.onreadystatechange=function(){
		if (request.readyState == 4){
			if (request.status == 200){
				document.getElementById("searchResult").innerHTML = request.responseText;				
			}else{
				alert("error:"+request.status);
			}
		}
	}
}
function btnCreate_Click(){
	var request = new XMLHttpRequest();
	var url = "service.php";	
	request.open("POST", url, true);
	request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	var para = "name="+document.getElementById("name").value
				+"&number="+document.getElementById("number").value
				+"&sex="+document.getElementById("sex").selected
				+"&job="+document.getElementById("job").value;
	request.send(para);
	request.onreadystatechange=function(){
		if (request.readyState == 4){
			if (request.status == 200){
				document.getElementById("createResult").innerHTML = request.responseText;				
			}else{
				alert("error:"+request.status);
			}
		}
	}
}